package com.itheima.File文件.file练习;

import java.io.File;

public class 删除多级文件夹版本3 {
    public static void main(String[] args) {
        File file = new File("C:\\Users\\身体和心灵\\Desktop\\src");
        deleteFile(file);
    }

    private static void deleteFile(File file) {
        if (!file.isFile() && file.exists()) {
            File[] files = file.listFiles();
            for (File file1 : files) {
                deleteFile(file1);
            }
        }
        System.out.println(file.getName());
        file.delete();
    }
}
